//字符串转txt下载
export function useDownloadTxt(content: string, fileName: string = 'log') {
  const blob = new Blob([content], { type: 'text/plain' })
  const url = URL.createObjectURL(blob)
  const aLink = document.createElement('a')
  aLink.href = url
  aLink.download = `${fileName}.txt`
  aLink.click()
  URL.revokeObjectURL(url)
  aLink.remove()
}
/**预览自定义页面 */
export const previewWithNewPage = (body: string) => {
  const newWin = window.open('', '', '')
  if (!newWin) return
  newWin.opener = null // 防止代码对论谈页面修改
  newWin.document.write(body || '')
  newWin.document.close()
}
